package cat.music.ut.bean

import androidx.annotation.Keep
import cat.music.ut.component.log
@Keep
data class AudioInfo(
    val level: String,
    val bitrate: Int,
    val format: String,
    val size: String
){
    var url = ""
}
fun parseAudioInfo(input: String): List<AudioInfo> {
    "input = $input".log()
    return input.split(";")
        .filter { it.isNotBlank() }
        .map { entry ->
            val map = entry.split(",")
                .associate {
                    val (key, value) = it.split(":")
                    key to value
                }
            AudioInfo(
                level = map["level"] ?: "",
                bitrate = map["bitrate"]?.toIntOrNull() ?: 0,
                format = map["format"] ?: "",
                size = map["size"] ?: ""
            )
        }
}
